Integrand size = 41, antiderivative size = 139 \[ \int \frac {\cos ^2(c+d x) \left (A+B \cos (c+d x)+C \cos ^2(c+d x)\right )}{a+a \cos (c+d x)} \, dx=-\frac {(2 A-3 B+3 C) x}{2 a}+\frac {(3 A-3 B+4 C) \sin (c+d x)}{a d}-\frac {(2 A-3 B+3 C) \cos (c+d x) \sin (c+d x)}{2 a d}-\frac {(A-B+C) \cos ^3(c+d x) \sin (c+d x)}{d (a+a \cos (c+d x))}-\frac {(3 A-3 B+4 C) \sin ^3(c+d x)}{3 a d} \]
-1/2*(2*A-3*B+3*C)*x/a+(3*A-3*B+4*C)*sin(d*x+c)/a/d-1/2*(2*A-3*B+3*C)*cos( d*x+c)*sin(d*x+c)/a/d-(A-B+C)*cos(d*x+c)^3*sin(d*x+c)/d/(a+a*cos(d*x+c))-1 /3*(3*A-3*B+4*C)*sin(d*x+c)^3/a/d
Leaf count is larger than twice the leaf count of optimal. \(307\) vs. \(2(139)=278\).
Time = 2.46 (sec) , antiderivative size = 307, normalized size of antiderivative = 2.21 \[ \int \frac {\cos ^2(c+d x) \left (A+B \cos (c+d x)+C \cos ^2(c+d x)\right )}{a+a \cos (c+d x)} \, dx=\frac {\cos \left (\frac {1}{2} (c+d x)\right ) \sec \left (\frac {c}{2}\right ) \left (-12 (2 A-3 B+3 C) d x \cos \left (\frac {d x}{2}\right )-12 (2 A-3 B+3 C) d x \cos \left (c+\frac {d x}{2}\right )+60 A \sin \left (\frac {d x}{2}\right )-60 B \sin \left (\frac {d x}{2}\right )+69 C \sin \left (\frac {d x}{2}\right )+12 A \sin \left (c+\frac {d x}{2}\right )-12 B \sin \left (c+\frac {d x}{2}\right )+21 C \sin \left (c+\frac {d x}{2}\right )+12 A \sin \left (c+\frac {3 d x}{2}\right )-9 B \sin \left (c+\frac {3 d x}{2}\right )+18 C \sin \left (c+\frac {3 d x}{2}\right )+12 A \sin \left (2 c+\frac {3 d x}{2}\right )-9 B \sin \left (2 c+\frac {3 d x}{2}\right )+18 C \sin \left (2 c+\frac {3 d x}{2}\right )+3 B \sin \left (2 c+\frac {5 d x}{2}\right )-2 C \sin \left (2 c+\frac {5 d x}{2}\right )+3 B \sin \left (3 c+\frac {5 d x}{2}\right )-2 C \sin \left (3 c+\frac {5 d x}{2}\right )+C \sin \left (3 c+\frac {7 d x}{2}\right )+C \sin \left (4 c+\frac {7 d x}{2}\right )\right )}{24 a d (1+\cos (c+d x))} \]
(Cos[(c + d*x)/2]*Sec[c/2]*(-12*(2*A - 3*B + 3*C)*d*x*Cos[(d*x)/2] - 12*(2 *A - 3*B + 3*C)*d*x*Cos[c + (d*x)/2] + 60*A*Sin[(d*x)/2] - 60*B*Sin[(d*x)/ 2] + 69*C*Sin[(d*x)/2] + 12*A*Sin[c + (d*x)/2] - 12*B*Sin[c + (d*x)/2] + 2 1*C*Sin[c + (d*x)/2] + 12*A*Sin[c + (3*d*x)/2] - 9*B*Sin[c + (3*d*x)/2] + 18*C*Sin[c + (3*d*x)/2] + 12*A*Sin[2*c + (3*d*x)/2] - 9*B*Sin[2*c + (3*d*x )/2] + 18*C*Sin[2*c + (3*d*x)/2] + 3*B*Sin[2*c + (5*d*x)/2] - 2*C*Sin[2*c + (5*d*x)/2] + 3*B*Sin[3*c + (5*d*x)/2] - 2*C*Sin[3*c + (5*d*x)/2] + C*Sin [3*c + (7*d*x)/2] + C*Sin[4*c + (7*d*x)/2]))/(24*a*d*(1 + Cos[c + d*x]))
Time = 0.62 (sec) , antiderivative size = 117, normalized size of antiderivative = 0.84, number of steps used = 11, number of rules used = 10, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.244, Rules used = {3042, 3520, 25, 3042, 3227, 3042, 3113, 2009, 3115, 24}
Below are the steps used by Rubi to obtain the solution. The rule number used for the transformation is given above next to the arrow. The rules definitions used are listed below.
\(\displaystyle \int \frac {\cos ^2(c+d x) \left (A+B \cos (c+d x)+C \cos ^2(c+d x)\right )}{a \cos (c+d x)+a} \, dx\) |
\(\Big \downarrow \) 3042 |
\(\displaystyle \int \frac {\sin \left (c+d x+\frac {\pi }{2}\right )^2 \left (A+B \sin \left (c+d x+\frac {\pi }{2}\right )+C \sin \left (c+d x+\frac {\pi }{2}\right )^2\right )}{a \sin \left (c+d x+\frac {\pi }{2}\right )+a}dx\) |
\(\Big \downarrow \) 3520 |
\(\displaystyle \frac {\int -\cos ^2(c+d x) (a (2 A-3 B+3 C)-a (3 A-3 B+4 C) \cos (c+d x))dx}{a^2}-\frac {(A-B+C) \sin (c+d x) \cos ^3(c+d x)}{d (a \cos (c+d x)+a)}\) |
\(\Big \downarrow \) 25 |
\(\displaystyle -\frac {\int \cos ^2(c+d x) (a (2 A-3 B+3 C)-a (3 A-3 B+4 C) \cos (c+d x))dx}{a^2}-\frac {(A-B+C) \sin (c+d x) \cos ^3(c+d x)}{d (a \cos (c+d x)+a)}\) |
\(\Big \downarrow \) 3042 |
\(\displaystyle -\frac {\int \sin \left (c+d x+\frac {\pi }{2}\right )^2 \left (a (2 A-3 B+3 C)-a (3 A-3 B+4 C) \sin \left (c+d x+\frac {\pi }{2}\right )\right )dx}{a^2}-\frac {(A-B+C) \sin (c+d x) \cos ^3(c+d x)}{d (a \cos (c+d x)+a)}\) |
\(\Big \downarrow \) 3227 |
\(\displaystyle -\frac {a (2 A-3 B+3 C) \int \cos ^2(c+d x)dx-a (3 A-3 B+4 C) \int \cos ^3(c+d x)dx}{a^2}-\frac {(A-B+C) \sin (c+d x) \cos ^3(c+d x)}{d (a \cos (c+d x)+a)}\) |
\(\Big \downarrow \) 3042 |
\(\displaystyle -\frac {a (2 A-3 B+3 C) \int \sin \left (c+d x+\frac {\pi }{2}\right )^2dx-a (3 A-3 B+4 C) \int \sin \left (c+d x+\frac {\pi }{2}\right )^3dx}{a^2}-\frac {(A-B+C) \sin (c+d x) \cos ^3(c+d x)}{d (a \cos (c+d x)+a)}\) |
\(\Big \downarrow \) 3113 |
\(\displaystyle -\frac {\frac {a (3 A-3 B+4 C) \int \left (1-\sin ^2(c+d x)\right )d(-\sin (c+d x))}{d}+a (2 A-3 B+3 C) \int \sin \left (c+d x+\frac {\pi }{2}\right )^2dx}{a^2}-\frac {(A-B+C) \sin (c+d x) \cos ^3(c+d x)}{d (a \cos (c+d x)+a)}\) |
\(\Big \downarrow \) 2009 |
\(\displaystyle -\frac {a (2 A-3 B+3 C) \int \sin \left (c+d x+\frac {\pi }{2}\right )^2dx+\frac {a (3 A-3 B+4 C) \left (\frac {1}{3} \sin ^3(c+d x)-\sin (c+d x)\right )}{d}}{a^2}-\frac {(A-B+C) \sin (c+d x) \cos ^3(c+d x)}{d (a \cos (c+d x)+a)}\) |
\(\Big \downarrow \) 3115 |
\(\displaystyle -\frac {a (2 A-3 B+3 C) \left (\frac {\int 1dx}{2}+\frac {\sin (c+d x) \cos (c+d x)}{2 d}\right )+\frac {a (3 A-3 B+4 C) \left (\frac {1}{3} \sin ^3(c+d x)-\sin (c+d x)\right )}{d}}{a^2}-\frac {(A-B+C) \sin (c+d x) \cos ^3(c+d x)}{d (a \cos (c+d x)+a)}\) |
\(\Big \downarrow \) 24 |
\(\displaystyle -\frac {\frac {a (3 A-3 B+4 C) \left (\frac {1}{3} \sin ^3(c+d x)-\sin (c+d x)\right )}{d}+a (2 A-3 B+3 C) \left (\frac {\sin (c+d x) \cos (c+d x)}{2 d}+\frac {x}{2}\right )}{a^2}-\frac {(A-B+C) \sin (c+d x) \cos ^3(c+d x)}{d (a \cos (c+d x)+a)}\) |
-(((A - B + C)*Cos[c + d*x]^3*Sin[c + d*x])/(d*(a + a*Cos[c + d*x]))) - (a *(2*A - 3*B + 3*C)*(x/2 + (Cos[c + d*x]*Sin[c + d*x])/(2*d)) + (a*(3*A - 3 *B + 4*C)*(-Sin[c + d*x] + Sin[c + d*x]^3/3))/d)/a^2
3.4.40.3.1 Defintions of rubi rules used
Int[sin[(c_.) + (d_.)*(x_)]^(n_), x_Symbol] :> Simp[-d^(-1) Subst[Int[Exp and[(1 - x^2)^((n - 1)/2), x], x], x, Cos[c + d*x]], x] /; FreeQ[{c, d}, x] && IGtQ[(n - 1)/2, 0]
Int[((b_.)*sin[(c_.) + (d_.)*(x_)])^(n_), x_Symbol] :> Simp[(-b)*Cos[c + d* x]*((b*Sin[c + d*x])^(n - 1)/(d*n)), x] + Simp[b^2*((n - 1)/n) Int[(b*Sin [c + d*x])^(n - 2), x], x] /; FreeQ[{b, c, d}, x] && GtQ[n, 1] && IntegerQ[ 2*n]
Int[((b_.)*sin[(e_.) + (f_.)*(x_)])^(m_)*((c_) + (d_.)*sin[(e_.) + (f_.)*(x _)]), x_Symbol] :> Simp[c Int[(b*Sin[e + f*x])^m, x], x] + Simp[d/b Int [(b*Sin[e + f*x])^(m + 1), x], x] /; FreeQ[{b, c, d, e, f, m}, x]
Int[((a_) + (b_.)*sin[(e_.) + (f_.)*(x_)])^(m_)*((c_.) + (d_.)*sin[(e_.) + (f_.)*(x_)])^(n_.)*((A_.) + (B_.)*sin[(e_.) + (f_.)*(x_)] + (C_.)*sin[(e_.) + (f_.)*(x_)]^2), x_Symbol] :> Simp[(a*A - b*B + a*C)*Cos[e + f*x]*(a + b* Sin[e + f*x])^m*((c + d*Sin[e + f*x])^(n + 1)/(f*(b*c - a*d)*(2*m + 1))), x ] + Simp[1/(b*(b*c - a*d)*(2*m + 1)) Int[(a + b*Sin[e + f*x])^(m + 1)*(c + d*Sin[e + f*x])^n*Simp[A*(a*c*(m + 1) - b*d*(2*m + n + 2)) + B*(b*c*m + a *d*(n + 1)) - C*(a*c*m + b*d*(n + 1)) + (d*(a*A - b*B)*(m + n + 2) + C*(b*c *(2*m + 1) - a*d*(m - n - 1)))*Sin[e + f*x], x], x], x] /; FreeQ[{a, b, c, d, e, f, A, B, C, n}, x] && NeQ[b*c - a*d, 0] && EqQ[a^2 - b^2, 0] && NeQ[c ^2 - d^2, 0] && LtQ[m, -2^(-1)]
Time = 1.82 (sec) , antiderivative size = 87, normalized size of antiderivative = 0.63
method | result | size |
parallelrisch | \(\frac {\left (\left (3 B -C \right ) \cos \left (2 d x +2 c \right )+C \cos \left (3 d x +3 c \right )+\left (12 A -6 B +17 C \right ) \cos \left (d x +c \right )+24 A -21 B +31 C \right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )-12 x d \left (-\frac {3 B}{2}+\frac {3 C}{2}+A \right )}{12 a d}\) | \(87\) |
derivativedivides | \(\frac {A \tan \left (\frac {d x}{2}+\frac {c}{2}\right )-B \tan \left (\frac {d x}{2}+\frac {c}{2}\right )+\tan \left (\frac {d x}{2}+\frac {c}{2}\right ) C -\frac {2 \left (\left (\frac {3 B}{2}-\frac {5 C}{2}-A \right ) \left (\tan ^{5}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )+\left (2 B -\frac {8 C}{3}-2 A \right ) \left (\tan ^{3}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )+\left (\frac {B}{2}-\frac {3 C}{2}-A \right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{\left (1+\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )^{3}}-\left (2 A -3 B +3 C \right ) \arctan \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{d a}\) | \(147\) |
default | \(\frac {A \tan \left (\frac {d x}{2}+\frac {c}{2}\right )-B \tan \left (\frac {d x}{2}+\frac {c}{2}\right )+\tan \left (\frac {d x}{2}+\frac {c}{2}\right ) C -\frac {2 \left (\left (\frac {3 B}{2}-\frac {5 C}{2}-A \right ) \left (\tan ^{5}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )+\left (2 B -\frac {8 C}{3}-2 A \right ) \left (\tan ^{3}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )+\left (\frac {B}{2}-\frac {3 C}{2}-A \right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{\left (1+\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )^{3}}-\left (2 A -3 B +3 C \right ) \arctan \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{d a}\) | \(147\) |
risch | \(-\frac {x A}{a}+\frac {3 B x}{2 a}-\frac {3 C x}{2 a}-\frac {i {\mathrm e}^{i \left (d x +c \right )} A}{2 a d}+\frac {i {\mathrm e}^{i \left (d x +c \right )} B}{2 a d}-\frac {7 i {\mathrm e}^{i \left (d x +c \right )} C}{8 a d}+\frac {i {\mathrm e}^{-i \left (d x +c \right )} A}{2 a d}-\frac {i {\mathrm e}^{-i \left (d x +c \right )} B}{2 a d}+\frac {7 i {\mathrm e}^{-i \left (d x +c \right )} C}{8 a d}+\frac {2 i A}{d a \left ({\mathrm e}^{i \left (d x +c \right )}+1\right )}-\frac {2 i B}{d a \left ({\mathrm e}^{i \left (d x +c \right )}+1\right )}+\frac {2 i C}{d a \left ({\mathrm e}^{i \left (d x +c \right )}+1\right )}+\frac {\sin \left (3 d x +3 c \right ) C}{12 a d}+\frac {\sin \left (2 d x +2 c \right ) B}{4 a d}-\frac {\sin \left (2 d x +2 c \right ) C}{4 a d}\) | \(260\) |
norman | \(\frac {\frac {\left (A -B +C \right ) \left (\tan ^{9}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{a d}+\frac {\left (3 A -2 B +4 C \right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{a d}+\frac {\left (6 A -7 B +9 C \right ) \left (\tan ^{7}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{a d}-\frac {\left (2 A -3 B +3 C \right ) x}{2 a}-\frac {2 \left (2 A -3 B +3 C \right ) x \left (\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{a}-\frac {3 \left (2 A -3 B +3 C \right ) x \left (\tan ^{4}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{a}-\frac {2 \left (2 A -3 B +3 C \right ) x \left (\tan ^{6}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{a}-\frac {\left (2 A -3 B +3 C \right ) x \left (\tan ^{8}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{2 a}+\frac {\left (30 A -27 B +37 C \right ) \left (\tan ^{3}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{3 a d}+\frac {\left (36 A -39 B +49 C \right ) \left (\tan ^{5}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{3 a d}}{\left (1+\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )^{4}}\) | \(278\) |
1/12*(((3*B-C)*cos(2*d*x+2*c)+C*cos(3*d*x+3*c)+(12*A-6*B+17*C)*cos(d*x+c)+ 24*A-21*B+31*C)*tan(1/2*d*x+1/2*c)-12*x*d*(-3/2*B+3/2*C+A))/a/d
Time = 0.27 (sec) , antiderivative size = 114, normalized size of antiderivative = 0.82 \[ \int \frac {\cos ^2(c+d x) \left (A+B \cos (c+d x)+C \cos ^2(c+d x)\right )}{a+a \cos (c+d x)} \, dx=-\frac {3 \, {\left (2 \, A - 3 \, B + 3 \, C\right )} d x \cos \left (d x + c\right ) + 3 \, {\left (2 \, A - 3 \, B + 3 \, C\right )} d x - {\left (2 \, C \cos \left (d x + c\right )^{3} + {\left (3 \, B - C\right )} \cos \left (d x + c\right )^{2} + {\left (6 \, A - 3 \, B + 7 \, C\right )} \cos \left (d x + c\right ) + 12 \, A - 12 \, B + 16 \, C\right )} \sin \left (d x + c\right )}{6 \, {\left (a d \cos \left (d x + c\right ) + a d\right )}} \]
integrate(cos(d*x+c)^2*(A+B*cos(d*x+c)+C*cos(d*x+c)^2)/(a+a*cos(d*x+c)),x, algorithm="fricas")
-1/6*(3*(2*A - 3*B + 3*C)*d*x*cos(d*x + c) + 3*(2*A - 3*B + 3*C)*d*x - (2* C*cos(d*x + c)^3 + (3*B - C)*cos(d*x + c)^2 + (6*A - 3*B + 7*C)*cos(d*x + c) + 12*A - 12*B + 16*C)*sin(d*x + c))/(a*d*cos(d*x + c) + a*d)
Leaf count of result is larger than twice the leaf count of optimal. 1739 vs. \(2 (116) = 232\).
Time = 1.64 (sec) , antiderivative size = 1739, normalized size of antiderivative = 12.51 \[ \int \frac {\cos ^2(c+d x) \left (A+B \cos (c+d x)+C \cos ^2(c+d x)\right )}{a+a \cos (c+d x)} \, dx=\text {Too large to display} \]
Piecewise((-6*A*d*x*tan(c/2 + d*x/2)**6/(6*a*d*tan(c/2 + d*x/2)**6 + 18*a* d*tan(c/2 + d*x/2)**4 + 18*a*d*tan(c/2 + d*x/2)**2 + 6*a*d) - 18*A*d*x*tan (c/2 + d*x/2)**4/(6*a*d*tan(c/2 + d*x/2)**6 + 18*a*d*tan(c/2 + d*x/2)**4 + 18*a*d*tan(c/2 + d*x/2)**2 + 6*a*d) - 18*A*d*x*tan(c/2 + d*x/2)**2/(6*a*d *tan(c/2 + d*x/2)**6 + 18*a*d*tan(c/2 + d*x/2)**4 + 18*a*d*tan(c/2 + d*x/2 )**2 + 6*a*d) - 6*A*d*x/(6*a*d*tan(c/2 + d*x/2)**6 + 18*a*d*tan(c/2 + d*x/ 2)**4 + 18*a*d*tan(c/2 + d*x/2)**2 + 6*a*d) + 6*A*tan(c/2 + d*x/2)**7/(6*a *d*tan(c/2 + d*x/2)**6 + 18*a*d*tan(c/2 + d*x/2)**4 + 18*a*d*tan(c/2 + d*x /2)**2 + 6*a*d) + 30*A*tan(c/2 + d*x/2)**5/(6*a*d*tan(c/2 + d*x/2)**6 + 18 *a*d*tan(c/2 + d*x/2)**4 + 18*a*d*tan(c/2 + d*x/2)**2 + 6*a*d) + 42*A*tan( c/2 + d*x/2)**3/(6*a*d*tan(c/2 + d*x/2)**6 + 18*a*d*tan(c/2 + d*x/2)**4 + 18*a*d*tan(c/2 + d*x/2)**2 + 6*a*d) + 18*A*tan(c/2 + d*x/2)/(6*a*d*tan(c/2 + d*x/2)**6 + 18*a*d*tan(c/2 + d*x/2)**4 + 18*a*d*tan(c/2 + d*x/2)**2 + 6 *a*d) + 9*B*d*x*tan(c/2 + d*x/2)**6/(6*a*d*tan(c/2 + d*x/2)**6 + 18*a*d*ta n(c/2 + d*x/2)**4 + 18*a*d*tan(c/2 + d*x/2)**2 + 6*a*d) + 27*B*d*x*tan(c/2 + d*x/2)**4/(6*a*d*tan(c/2 + d*x/2)**6 + 18*a*d*tan(c/2 + d*x/2)**4 + 18* a*d*tan(c/2 + d*x/2)**2 + 6*a*d) + 27*B*d*x*tan(c/2 + d*x/2)**2/(6*a*d*tan (c/2 + d*x/2)**6 + 18*a*d*tan(c/2 + d*x/2)**4 + 18*a*d*tan(c/2 + d*x/2)**2 + 6*a*d) + 9*B*d*x/(6*a*d*tan(c/2 + d*x/2)**6 + 18*a*d*tan(c/2 + d*x/2)** 4 + 18*a*d*tan(c/2 + d*x/2)**2 + 6*a*d) - 6*B*tan(c/2 + d*x/2)**7/(6*a*...
Leaf count of result is larger than twice the leaf count of optimal. 400 vs. \(2 (133) = 266\).
Time = 0.31 (sec) , antiderivative size = 400, normalized size of antiderivative = 2.88 \[ \int \frac {\cos ^2(c+d x) \left (A+B \cos (c+d x)+C \cos ^2(c+d x)\right )}{a+a \cos (c+d x)} \, dx=\frac {C {\left (\frac {\frac {9 \, \sin \left (d x + c\right )}{\cos \left (d x + c\right ) + 1} + \frac {16 \, \sin \left (d x + c\right )^{3}}{{\left (\cos \left (d x + c\right ) + 1\right )}^{3}} + \frac {15 \, \sin \left (d x + c\right )^{5}}{{\left (\cos \left (d x + c\right ) + 1\right )}^{5}}}{a + \frac {3 \, a \sin \left (d x + c\right )^{2}}{{\left (\cos \left (d x + c\right ) + 1\right )}^{2}} + \frac {3 \, a \sin \left (d x + c\right )^{4}}{{\left (\cos \left (d x + c\right ) + 1\right )}^{4}} + \frac {a \sin \left (d x + c\right )^{6}}{{\left (\cos \left (d x + c\right ) + 1\right )}^{6}}} - \frac {9 \, \arctan \left (\frac {\sin \left (d x + c\right )}{\cos \left (d x + c\right ) + 1}\right )}{a} + \frac {3 \, \sin \left (d x + c\right )}{a {\left (\cos \left (d x + c\right ) + 1\right )}}\right )} - 3 \, B {\left (\frac {\frac {\sin \left (d x + c\right )}{\cos \left (d x + c\right ) + 1} + \frac {3 \, \sin \left (d x + c\right )^{3}}{{\left (\cos \left (d x + c\right ) + 1\right )}^{3}}}{a + \frac {2 \, a \sin \left (d x + c\right )^{2}}{{\left (\cos \left (d x + c\right ) + 1\right )}^{2}} + \frac {a \sin \left (d x + c\right )^{4}}{{\left (\cos \left (d x + c\right ) + 1\right )}^{4}}} - \frac {3 \, \arctan \left (\frac {\sin \left (d x + c\right )}{\cos \left (d x + c\right ) + 1}\right )}{a} + \frac {\sin \left (d x + c\right )}{a {\left (\cos \left (d x + c\right ) + 1\right )}}\right )} - 3 \, A {\left (\frac {2 \, \arctan \left (\frac {\sin \left (d x + c\right )}{\cos \left (d x + c\right ) + 1}\right )}{a} - \frac {2 \, \sin \left (d x + c\right )}{{\left (a + \frac {a \sin \left (d x + c\right )^{2}}{{\left (\cos \left (d x + c\right ) + 1\right )}^{2}}\right )} {\left (\cos \left (d x + c\right ) + 1\right )}} - \frac {\sin \left (d x + c\right )}{a {\left (\cos \left (d x + c\right ) + 1\right )}}\right )}}{3 \, d} \]
integrate(cos(d*x+c)^2*(A+B*cos(d*x+c)+C*cos(d*x+c)^2)/(a+a*cos(d*x+c)),x, algorithm="maxima")
1/3*(C*((9*sin(d*x + c)/(cos(d*x + c) + 1) + 16*sin(d*x + c)^3/(cos(d*x + c) + 1)^3 + 15*sin(d*x + c)^5/(cos(d*x + c) + 1)^5)/(a + 3*a*sin(d*x + c)^ 2/(cos(d*x + c) + 1)^2 + 3*a*sin(d*x + c)^4/(cos(d*x + c) + 1)^4 + a*sin(d *x + c)^6/(cos(d*x + c) + 1)^6) - 9*arctan(sin(d*x + c)/(cos(d*x + c) + 1) )/a + 3*sin(d*x + c)/(a*(cos(d*x + c) + 1))) - 3*B*((sin(d*x + c)/(cos(d*x + c) + 1) + 3*sin(d*x + c)^3/(cos(d*x + c) + 1)^3)/(a + 2*a*sin(d*x + c)^ 2/(cos(d*x + c) + 1)^2 + a*sin(d*x + c)^4/(cos(d*x + c) + 1)^4) - 3*arctan (sin(d*x + c)/(cos(d*x + c) + 1))/a + sin(d*x + c)/(a*(cos(d*x + c) + 1))) - 3*A*(2*arctan(sin(d*x + c)/(cos(d*x + c) + 1))/a - 2*sin(d*x + c)/((a + a*sin(d*x + c)^2/(cos(d*x + c) + 1)^2)*(cos(d*x + c) + 1)) - sin(d*x + c) /(a*(cos(d*x + c) + 1))))/d
Time = 0.31 (sec) , antiderivative size = 207, normalized size of antiderivative = 1.49 \[ \int \frac {\cos ^2(c+d x) \left (A+B \cos (c+d x)+C \cos ^2(c+d x)\right )}{a+a \cos (c+d x)} \, dx=-\frac {\frac {3 \, {\left (d x + c\right )} {\left (2 \, A - 3 \, B + 3 \, C\right )}}{a} - \frac {6 \, {\left (A \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - B \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + C \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )\right )}}{a} - \frac {2 \, {\left (6 \, A \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{5} - 9 \, B \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{5} + 15 \, C \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{5} + 12 \, A \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} - 12 \, B \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} + 16 \, C \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} + 6 \, A \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - 3 \, B \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + 9 \, C \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )\right )}}{{\left (\tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} + 1\right )}^{3} a}}{6 \, d} \]
-1/6*(3*(d*x + c)*(2*A - 3*B + 3*C)/a - 6*(A*tan(1/2*d*x + 1/2*c) - B*tan( 1/2*d*x + 1/2*c) + C*tan(1/2*d*x + 1/2*c))/a - 2*(6*A*tan(1/2*d*x + 1/2*c) ^5 - 9*B*tan(1/2*d*x + 1/2*c)^5 + 15*C*tan(1/2*d*x + 1/2*c)^5 + 12*A*tan(1 /2*d*x + 1/2*c)^3 - 12*B*tan(1/2*d*x + 1/2*c)^3 + 16*C*tan(1/2*d*x + 1/2*c )^3 + 6*A*tan(1/2*d*x + 1/2*c) - 3*B*tan(1/2*d*x + 1/2*c) + 9*C*tan(1/2*d* x + 1/2*c))/((tan(1/2*d*x + 1/2*c)^2 + 1)^3*a))/d
Time = 2.87 (sec) , antiderivative size = 153, normalized size of antiderivative = 1.10 \[ \int \frac {\cos ^2(c+d x) \left (A+B \cos (c+d x)+C \cos ^2(c+d x)\right )}{a+a \cos (c+d x)} \, dx=\frac {\left (2\,A-3\,B+5\,C\right )\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^5+\left (4\,A-4\,B+\frac {16\,C}{3}\right )\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^3+\left (2\,A-B+3\,C\right )\,\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}{d\,\left (a\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^6+3\,a\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^4+3\,a\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^2+a\right )}-\frac {x\,\left (2\,A-3\,B+3\,C\right )}{2\,a}+\frac {\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )\,\left (A-B+C\right )}{a\,d} \]